/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package proyectoescuela;

import javax.persistence.EntityManagerFactory;

/**
 *
 * @author userlab09
 */
public class Conexion {
    private static final Conexion singleton = new Conexion();
    protected EntityManagerFactory emf;
    protected Conexion(){
    }
    public static Conexion ObtenerInstancia(){
        return singleton;
    }
    public EntityManagerFactory ObtenerEMF(){
        if(emf==null){
            CrearEMF();
        }
        return emf;
    }
    public void CrearEMF(){
        this.emf = javax.persistence.Persistence.createEntityManagerFactory("ProyectoEscuelaPU");
    }
}
